package base.mathlogic;

public class FindOverhalfNumber {

	public static void main(String[] args) {
		int[] arr = new int[]{9,2,11,7,11,11,11,7,9,3,11,11,11};
		int len = arr.length;
		//System.out.println(len);
		int minCount = (len/3/2);
		//System.out.println(minCount);
		int count = 1;
		int a=-1,b=-1,c=-1;
		int moreNumber1 = -1;
		int moreNumber2 = -1;
		for (int i=0;i<len;i=i+3) {
			a = arr[i];
			if(i+1<len) {
				b = arr[i+1];
			}
			if(i+2<len) {
				c = arr[i+2];
			}
			if(b==-1) {
				if(a==moreNumber1) {
					count++;
				}
			}else if(c==-1) {
				if(a==moreNumber1 || b==moreNumber1) {
					count++;
				}
			}
			int tep = a^b^c;
			if(tep==a) {
				if(moreNumber1 == -1) {
					moreNumber1 = b;
				}else {
					moreNumber2 = b;
					if(moreNumber1!=moreNumber2) {
						moreNumber1 = -1;
						moreNumber2 = -1;
					}else {
						count++;
						moreNumber2 = -1;
					}
				}
			}
			if(tep==b) {
				if(moreNumber1 == -1) {
					moreNumber1 = a;
				} else {
					moreNumber2 = a;
					if(moreNumber1!=moreNumber2) {
						moreNumber1 = -1;
						moreNumber2 = -1;
					}else {
						count++;
						moreNumber2 = -1;
					}
				}
			}
			if(tep == c) {
				if(moreNumber1 == -1) {
					moreNumber1 = a;
				} else {
					moreNumber2 = a;
					if(moreNumber1!=moreNumber2) {
						moreNumber1 = -1;
						moreNumber2 = -1;
					}else {
						count++;
						moreNumber2 = -1;
					}
				}
			}
			a = -1;
			b = -1;
			c = -1;
		}
		if(count>minCount) {
			System.out.println(moreNumber1);
		}else {
			System.out.println("无");
		}
	}

}
